import echarts from '@/echarts'

export var option = {
    title: {
        text: '贫困户年龄分布',
        x: 'center',
        top: '5%',
        textStyle: {
            color: '#ffffff',
            align: 'center',
            fontSize: 20
        }
    },
    grid: {
        top: '15%',
        bottom: '5%',
        left: '12%',
        right: '5%'
    },
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            type: 'shadow'
        },
        formatter: function (data: any) {
            console.log(data)
            let html = ``
            html = `
           <div>${data[0].marker} ${data[0].name}: ${data[0].value}人</div>
           `
            return html
        }
    },
    calculable: true,
    legend: {
        show: false
    },
    xAxis: [
        {
            type: 'category',
            axisLabel: {
                show: true,
                color: '#ffffff'
            },
            axisLine: {
                show: true,
                lineStyle: {
                    color: '#397cbc'
                }
            },
            data: []
        }
    ],
    yAxis: [
        {
            type: 'value',
            name: '单位：人',
            nameTextStyle: {
                color: '#ffffff'
            },
            axisLabel: {
                color: '#ffffff'
            },
            splitLine: {
                show: true,
                lineStyle: {
                    color: '#0a3256'
                }
            }
        }
    ],
    series: [
        {
            name: '人数',
            type: 'bar',
            label: {
                show: true,
                position: 'top',
                color: '#fff'
            },
            itemStyle: {
                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                    { offset: 0, color: '#4B87FFFF' },
                    { offset: 1, color: '#82BCFFFF' }
                ])
            },
            data: []
        }
    ]
} as any

export default echarts
